This tutorial assumes you have Immich running on your TrueNAS Scale server, a Cloudflare account, and at least one domain registered to your Cloudflare account.
Steps
-
Go to your Cloudflare account dashboard Account Home | Cloudflare
-
Cloudflare dashboard sidebar -> Zero Trust Cloudflare One
-
Zero Trust sidebar -> Networks -> Tunnels Tunnels - Cloudflare One
-
Create a tunnel
- select tunnel type Cloudflared
- name the tunnel
- save your tunnel
-
Get the token for your tunnel
- For TrueNAS scale you just need the token, not the whole command. So it doesn't matter what operating system or whatever you select, but you have to copy the whole command and then paste it somewhere and get just the token.
-
Install Cloudflared app on your TrueNAS
- put the token from the previous step in for "Tunnel Token"
- It should work to leave everything else at the default.
- Click install. Once Cloudflared is installed and running on your TrueNAS Scale server, it should appear in the tunnel dashboard under "Connectors".
-
Add a public hostname
- Click next in the Cloudflare tunnel configuration page
- For the service type, by default Immich is http only, which should be fine since Cloudflare tunnels gives you https. Anyway, assuming this is the case for you as well, select http for the type.
- For the Service URL, unfortunately the Immich app does not run on localhost on TrueNAS Scale, so you have to find the IP that is is running at. In my case Immich was running at 172.16.0.5:30041. (30041 is the default port for the Immich app on TrueNAS Scale)
- I had to go to the TrueNAS shell, run
netstat
and find the IP address that was using the port:30041
.netstat
does not show infinite network activity, so it might be helpful to refresh or open the local Immich web portal right before you runnetstat
. - You might have to update the IP address in Cloudflare after updating Immich or changing app settings in TrueNAS.
- I had to go to the TrueNAS shell, run
-
Save the tunnel.
-
It should work now. Try navigating to the public hostname you set.